package com.example.ecs.components.render;

import com.example.ecs.core.ComponentKey;

import java.awt.Color;
import java.awt.Graphics2D;

/**
 * CircleRenderComponent类表示圆形渲染组件
 */
@ComponentKey(RenderableComponent.class)
public class CircleRenderComponent extends RenderableComponent {
    public int radius;
    
    public CircleRenderComponent(Color color, int radius) {
        super(color);
        this.radius = radius;
    }
    
    @Override
    public void render(Graphics2D g, double x, double y) {
        g.setColor(color);
        g.fillOval((int)(x - radius), (int)(y - radius), radius * 2, radius * 2);
    }
}